package com.example.wanjialei.controller;

import com.example.wanjialei.pojo.Information;
import com.example.wanjialei.service.InformationService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;
@CrossOrigin
@RestController
public class InformationController {
    @Resource
    private InformationService informationService;

    @RequestMapping("/getInformationInfo")
    public Map<String, Object> getAdvisoryInfo() {
        return informationService.selectAll();
    }

    @RequestMapping("/modifyInformationInfoById")
    public Map<String, Object> modifyAdvisoryInfoById(@RequestBody Information information) {
        return informationService.modifyById(information);
    }

    @RequestMapping("/deleteInformationById")
    public Map<String, Object> deleteAdvisoryById(@RequestBody Information information) {
        return informationService.deleteById(information);
    }

    @RequestMapping("/insertInformationInfo")
    public Map<String, Object> insertAdvisoryInfo(@RequestBody Information information) {
        return informationService.insert(information);
    }
}
